package com.atguigu.yygh.common.handler;

import com.atguigu.yygh.common.result.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @Author:hx
 * @DateTime:2022/10/31 10:59
 * @Description:
 */
@RestControllerAdvice
@Slf4j
public class GlobalExceptionHandler {

    @ExceptionHandler(value = Exception.class)
    public R exceptionHandle(Exception e){
        log.error(e.getMessage());
        e.printStackTrace();
        return R.error();
    }
}
